package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.TenantQuestionnaireTasksMapper;
import com.hgkj.cloud.base.domain.TenantQuestionnaireTasks;
import com.hgkj.cloud.base.service.TenantQuestionnaireTasksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TenantQuestionnaireTasksServiceImpl implements TenantQuestionnaireTasksService {

    @Autowired
    private TenantQuestionnaireTasksMapper tenantQuestionnaireTasksMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return tenantQuestionnaireTasksMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TenantQuestionnaireTasks record) {
        return tenantQuestionnaireTasksMapper.insert(record);
    }

    @Override
    public int insertSelective(TenantQuestionnaireTasks record) {
        return tenantQuestionnaireTasksMapper.insertSelective(record);
    }

    @Override
    public TenantQuestionnaireTasks selectByPrimaryKey(Long id) {
        return tenantQuestionnaireTasksMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TenantQuestionnaireTasks record) {
        return tenantQuestionnaireTasksMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TenantQuestionnaireTasks record) {
        return tenantQuestionnaireTasksMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<TenantQuestionnaireTasks> listUnPublishQnTasks() {
        return tenantQuestionnaireTasksMapper.listUnPublishQnTasks();
    }

    @Override
    public List<TenantQuestionnaireTasks> listAllQnTasks(PageInfo pi, Map<String, Object> map) {
        if (pi != null) {
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTasksMapper.listAllQnTasks(map);
    }

    @Override
    public int findAllQnTaskCount(Map<String, Object> map) {
        return tenantQuestionnaireTasksMapper.findAllQnTaskCount(map);
    }

    @Override
    public long findTasksCount(String admin_uuid) {
        return tenantQuestionnaireTasksMapper.findTasksCount(admin_uuid);
    }

    @Override
    public long findTasksCountByUserUuid(String admin_uuid) {
        return tenantQuestionnaireTasksMapper.findTasksCountByUserUuid(admin_uuid);
    }

    @Override
    public List<Map<String, Object>> listQnTaskInfoByQnid(PageInfo pi, Map<String, Object> map) {
        if (pi != null) {
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantQuestionnaireTasksMapper.listQnTaskInfoByQnid(map);
    }

    @Override
    public long listQnTaskInfoByQnidCount(Map<String, Object> map) {
        return tenantQuestionnaireTasksMapper.listQnTaskInfoByQnidCount(map);
    }

    @Override
    public List<Map<String, Object>> getAllQnTasks(Map<String, Object> map) {
        return tenantQuestionnaireTasksMapper.getAllQnTasks(map);
    }
}
